home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / DEM / I-M / LineShare DEMO.sea / LineShare Scripts / Supra Fax2&TeleFinder < prev    next >
Text File  |  1993-01-28  |  5KB  |  246 lines

  1. !
  2. ! LineShare™ Script for SupraFax v32bis modems
  3. ! This script is designed for Class 2 fax software and -
  4. ! ••• Make sure that you have "H" or better ROMs in your modem!
  5. !
  6. ! This script is designed to use with the TeleFinder™ BBS.
  7. !
  8. ! For some reasons TeleFinder redefines the LineFeed character (S4)
  9. ! We don't redefine it really, but we emulate modem responses with that symbol
  10. ! This trick is done with the lines marked with '$$$$'
  11. !
  12. ! If you want to modify this script for your modem, pay attention to
  13. ! the line marked "#### Settings ####" - it should be modified first
  14. !
  15. ! The TeleFinder "Host Options" used:
  16. ! "Adjust BPS to line speed" - *disabled*
  17. ! "Use Break Reset" - *enabled*,
  18. !
  19.  
  20. ! ------------------------------------------
  21. ! Resetting the modem:
  22. ! ------------------------------------------
  23. @Hangup
  24.   SetTries 2
  25.   Flush
  26.   HsReset 0,0,17,19,0,0
  27. !
  28. ! Try to catch the "OK" answer, use the Escape seq and DTR transitions
  29. ! to enter the command mode
  30. !
  31. @Label 1
  32.   matchclr
  33.   matchstr 1 2 "OK\r\n"
  34.   write "ATH0&F1\r"
  35.   matchread 20
  36.   Write "+++"
  37.   DtrClear
  38.   pause 10
  39.   DtrSet
  40. !
  41.   DecTries
  42.   IfTries 0 1
  43. !
  44. ! OSErr -6019 "Modem error - the modem is not responding"
  45. !
  46.   exit -6019
  47. @Label 2
  48.   write "AT+FCLASS=0\r"
  49.   Jsr 100
  50.   write "AT+FAA=0\r"
  51.   Jsr 100
  52.   exit 0
  53. ! ------------------------------------------
  54. !    Receiving incoming calls
  55. ! ------------------------------------------
  56. @ANSWER
  57. @Label 10
  58. !
  59. ! Set the modem preferred speed first
  60. !
  61.   SERRESET 2400,0,8,1
  62.   Jsr 80
  63. !
  64. ! Set the common options
  65.   Jsr 70
  66. !
  67. ! Set the communication options:
  68. ! Extended response set
  69. ! • N1 - Connect at the highest rate
  70. ! • \N3 Enable MNP/V42 connections (for TeleFinder)
  71. ! •    &K4 - Xon/Xoff flow control (for Fax)
  72. ! • Fax mode, class 2 (to enable fax tuning commands)
  73. !
  74. @Label 11
  75. ! #### Settings ####
  76.   Write "ATX4N1\\N3&K4+FCLASS=2\r"
  77.   Jsr 100
  78. !
  79. ! Set the "work" speed
  80. !
  81. @Label 12
  82.   SERRESET 19200,0,8,1
  83.   Jsr 80
  84. !
  85. ! Set Fax parameters: LID, DCC,BOR
  86. !
  87.   Write "AT+FLID=\"Stalker_GmbH\"\r"
  88.   Jsr 100
  89.   Write "AT+FDCC=1,3,0,2,0,0,0,0\r"
  90.   Jsr 100
  91.   Write "AT+FBOR=1\r"
  92.   Jsr 100
  93. !
  94. ! Allow modem to receive fax messages
  95. !
  96.   Write "AT+FCR=1\r"
  97.   Jsr 100
  98. !
  99. ! Tell the modem to determine the type of the incoming call
  100. ! Fetch the tube after N rings, where N has been set in the control panel (^4)
  101. !
  102.   Write "ATS0=^4+FAA=1\r"
  103.   Jsr 100
  104. !
  105. ! Everything is ready - let's sit and wait for a call
  106. ! We'll wait for 2 minutes, then reinitiate the modem
  107. @Label 20
  108.   MatchClr
  109.   matchstr 1 20 "RING\r"
  110.   matchstr 2 21 "CONNECT"
  111.   matchstr 13 30 "+FCON"
  112.   matchstr 14 10 "\r\nNO  "
  113.   matchstr 15 10 "BUSY"
  114.   Matchread 1200
  115.   jump 10
  116. !
  117. ! Data connection has been established (we read "CONNECT")
  118. ! Remove everything till "\r\n" from the buffer
  119. ! Emulate the CONNECT 2400 message (with modified LineFeed chars)
  120. ! Attach the "TF" subPort
  121. !
  122. @Label 21
  123.   MatchClr
  124.   MatchStr 1 22 "\r\n"
  125.   MatchRead 10
  126.   exit -6019
  127. @Label 22
  128.   QueueInput "\r\27CONNECT 2400\r\27"
  129.   Attach "TF" (DTR,BREAK,ESCAPE,IDLELIMIT=60)
  130. !
  131. ! Fax connection has been established (we read "+FCON")
  132. ! Put the +FCON back to the buffer,
  133. ! Put the "RING" before the "+FCON"
  134. ! Attach the "Fax" subPort
  135. !
  136. @Label 30
  137.   QueueInput "\r\nRING\r\n\r\n+FCON"
  138.   Attach "Fax" (DTR,RESET,ESCAPE,IDLELimit=30)
  139. ! ------------------------------------------
  140. ! Originating a call through the "Fax" subPort
  141. ! ------------------------------------------
  142. @ORIGINATE "Fax"
  143. !
  144. ! Set the preffered speed
  145. !
  146. ! SERRESET 2400,0,8,1
  147. ! Jsr 80
  148. !
  149. ! Set the common options
  150. !
  151. ! Jsr 70
  152. !
  153. ! Set the "Data" speed
  154. !
  155.   SERRESET 19200,0,8,1
  156.   Jsr 80
  157. !
  158. ! Set the Fax mode
  159. !
  160.    Write "AT+FCLASS=2\r"
  161.   Jsr 100
  162. !
  163. ! Now emit all commands that the application has sent to that port,
  164. ! Prepare to receive all error result codes
  165. !
  166. !EmitClear "S","S","S","&","&","\\","\\"
  167.   Jsr 60
  168. !
  169. ! Prepare to connect
  170. !
  171.   Jsr 90
  172.   MatchStr 1 51 "\r\n+FCON"
  173.   HsReset *
  174.   Write "ATD^1\r"
  175.   MatchRead 700
  176.   Write "\r"
  177.   Exit -6019
  178. @LABEL 51
  179.   QueueInput "\r\n+FCON"
  180.   Attach "Fax" (DTR,RESET,ESCAPE,IDLELimit=30)
  181. !
  182. ! This section emits all modem commands sent by the client application
  183. ! For each set of commands the "OK" answer is awaited
  184. !
  185. @Label 60
  186.   EmitStart
  187. @Label 61
  188.   EmitCommand 62
  189.   Jsr 100
  190.   Jump 61
  191. @Label 62
  192.   return
  193. !
  194. ! This section initiates the modem before ANSWER and ORIGINATEs:
  195. ! factory settings + speaker control +
  196. ! reset on Dtr drop + DCD valid
  197. ! Verbal responses mode, no echo 
  198. ! Set &S1 (DSR) in case the cable connects the DSR signal with the CTS pin
  199. !
  200. @Label 70
  201.   Write "ATM^2L^3&D2&C1V1E0\r"
  202.   Jsr 100
  203.   return 
  204. !
  205. ! This section syncronize the modem after the serial port speed switching
  206. !
  207. @Label 80
  208.   ChrDelay 1
  209.   Write "AT\r"
  210.   ChrDelay 0
  211.   Jsr 100
  212.   return
  213. !
  214. ! Prepare to receive error result codes
  215. !
  216. @Label 90
  217.   MatchClr
  218.   MatchStr 2 91 "NO DIALTONE\r\n"
  219.   MatchStr 3 92 "BUSY\r\n"
  220.   MatchStr 4 93 "NO CARRIER\r\n"
  221.   MatchStr 5 94 "NO ANSWER\r\n"
  222.   return
  223. @Label 91
  224.   exit -6020
  225. @Label 92
  226.   exit -6022
  227. @Label 93
  228.   exit -6021
  229. @Label 94
  230.   exit -6023
  231. !
  232. ! Processing the AT command:
  233. ! OK -> proceed
  234. ! ERROR or TimeOut ->exit -6019
  235. ! It can be called AFTER the "Write" command, since LineShare buffers input
  236. !
  237. @Label 100
  238.   MatchClr
  239.   MatchStr 1 102 "\r\nOK\r\n"
  240.   MatchStr 2 101 "\r\nERROR\r\n"
  241.   MatchRead 20
  242. @Label 101
  243.   Exit -6019
  244. @Label 102
  245.   return
  246.